package com.bh.web.controller.fee;

import com.bh.common.annotation.Log;
import com.bh.common.core.controller.BaseController;
import com.bh.common.core.domain.AjaxResult;
import com.bh.common.enums.BusinessType;
import com.bh.fee.domain.JcDeliveryPrice;
import com.bh.fee.service.IJcDeliveryPriceService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 服务区域其他单价Controller
 * 
 * @author slx
 * @date 2023-07-07
 */
@RestController
@RequestMapping("/fee/deliveryPrice")
public class JcDeliveryPriceController extends BaseController
{
    @Autowired
    private IJcDeliveryPriceService jcDeliveryPriceService;

    /**
     * 查询服务区域其他单价列表
     */
    @ApiOperation("查询服务区域其他单价列表")
    @GetMapping("/list")
    public AjaxResult list(JcDeliveryPrice jcDeliveryPrice)
    {
        List<JcDeliveryPrice> list = jcDeliveryPriceService.selectJcDeliveryPriceList(jcDeliveryPrice);
        return AjaxResult.success(list);
    }

    /**
     * 获取服务区域其他单价详细信息
     */
    @ApiOperation("获取服务区域其他单价详细信息")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(jcDeliveryPriceService.selectJcDeliveryPriceById(id));
    }

    /**
     * 新增服务区域其他单价
     */
    @ApiOperation("新增服务区域其他单价")
    @Log(title = "服务区域其他单价", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JcDeliveryPrice jcDeliveryPrice)
    {
        return toAjax(jcDeliveryPriceService.insertJcDeliveryPrice(jcDeliveryPrice));
    }

    /**
     * 修改服务区域其他单价
     */
    @ApiOperation("修改服务区域其他单价")
    @Log(title = "服务区域其他单价", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JcDeliveryPrice jcDeliveryPrice)
    {
        return toAjax(jcDeliveryPriceService.updateJcDeliveryPrice(jcDeliveryPrice));
    }

    /**
     * 删除服务区域其他单价
     */
    @ApiOperation("删除服务区域其他单价")
    @Log(title = "服务区域其他单价", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(jcDeliveryPriceService.deleteJcDeliveryPriceByIds(ids));
    }
}
